package com.zdy.viewpager;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.andexert.expandablelayout.library.ExpandableLayoutListView;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem;

public class DemoFragmentExList extends Fragment {

  private FragmentActivity activity;
  private final String[] array = { "Hello", "World", "Android", "is", "Awesome", "World", "Android", "is", "Awesome",
      "World", "Android", "is", "Awesome", "World", "Android", "is", "Awesome" };

  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.ex_test, container, false);
  }

  PinnedSectionListView lv;

  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    activity = getActivity();
    int position = FragmentPagerItem.getPosition(getArguments());
    TextView title = (TextView) view.findViewById(R.id.item_title);
    title.setText(String.valueOf(position));

    final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(activity, R.layout.view_row, R.id.header_text,
        array);
    final ExpandableLayoutListView expandableLayoutListView = (ExpandableLayoutListView) view
        .findViewById(R.id.listview);

    expandableLayoutListView.setAdapter(arrayAdapter);
  }

}
